package com.flower.wing.main;

import java.sql.DriverManager;
import java.sql.SQLException;
import java.util.Properties;
import java.sql.Connection;

public class DBConnection {
	
	String dbDriver = null;
	String dbUrl = null;
	String dbUser = null;
	String dbPwd = null;
	
	Connection conn = null;
	
	public DBConnection(Properties info, Connection conn){
		dbDriver = info.getProperty("DBDRIVER");
		dbUrl = info.getProperty("DBURL");
		dbUser = info.getProperty("DBUSER");
		dbPwd = info.getProperty("DBPWD");
	}
	
	public Connection returnConn() {
		// TODO Auto-generated method stub
		
//		System.out.println(dbDriver + " : dbDriver, " + dbUrl + " : dbUrl, " + dbUser + " : dbUser," + dbPwd + " : dbPwd");
		
		try {
			Class.forName(dbDriver);
		} catch (ClassNotFoundException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		try {
			this.conn = DriverManager.getConnection(dbUrl, dbUser, dbPwd);
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		return conn;
	}
	
}
